<?php
require "../includes/db.php"; 
$mysqli = new MossCMS();
if ($_SESSION[$prefix.'_username'] == ""){  header("Location: ../login.php"); exit;}
if ($_SESSION[$prefix."_security"] < 1){header("location:../login.php?action=5"); exit;}



?>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="stylesheet" type="text/css" href="../includes/admin.css"/>
<title><?php echo $global_title;?></title>

</head>
<body>

<div id="wrap">
	<div id="page-header">
		<?php include('includes/header.php');?>

	</div>
	
	<div id="page-body">
		<div id="tabs">
			<?php $tab="main"; include('includes/header_tabs.php');?>
		</div>

		<div id="acp">
		<div class="panel">
			<span class="corners-top"><span></span></span>
				<div id="content">
				<div id="menu">
						
					<?php include('includes/menu_top.php');?>	
					<?php include('includes/menu_main.php');?>
					</div>
	
					<div id="main">
<a name="maincontent"></a>


	<h1>Logins</h1>

     
      <table class="underline">
            <thead>	
            	<tr>
            		<th>Time</th>
            		<th>User</th>
            		<th>IP</th>
            		<th>Refer</th>
            	</tr>
            </thead>
           <tbody> 
           
            
<?php
$results = $mysqli->logins_list();
      for($x=0; $x < sizeof($results); $x++) {
      	if($class == 'row2'){$class = 'row1';}else{$class = 'row2';}
      	$date = date('m/d/Y H:i:s',(strtotime($results[$x][login_timestamp])));
      	?>
      	
      	<tr class="<?php echo $class;?>">
      		<td style="font-size:7pt;"><?php echo $date;?></td>
      		<td><a href="user_edit.php?id=<?php echo $results[$x][username];?>"><?php echo $results[$x][username];?></a></td>
      		<td style="font-size:7pt;"><?php echo $results[$x]["login_ip"];?></td>
      		<td style="font-size:5pt;"><?php echo $results[$x]["login_refer"];?></td>
      	</tr>
            		  
   <?php $nolist = ''; } ?>
         </tbody>   
           </table> 
        

    </form>

    
		</div><!-- main -->
	</div><!-- content -->
<span class="corners-bottom"><span></span></span>
</div><!-- panel -->
</div><!-- acp -->

	
	<div id="page-footer">
	<?php include('includes/footer.php');?>
				</div>
</div><!-- page-body -->
</div><!-- wrap -->

</body> 
</html>